package com.example.mapper;

import com.example.pojo.Shift;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ShiftMapper {

    // 查询所有班次
    @Select("select * from shift")
    public List<Shift> findAll();

    // 根据ID删除班次
    @Select("delete from shift where ID = #{ID}")
    void deleteById(Integer ID);

    //添加班次
    @Select("insert into shift (ID,shiftName, beginTime, endTime) values (#{ID},#{shiftName},#{beginTime},#{endTime})")
    void insert(Shift shift);

    //修改班次
    @Select("update shift set shiftName = #{shiftName},beginTime = #{beginTime},endTime = #{endTime} where ID = #{ID}")
    void update(Shift shift);
}
